FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["src/Partner.Surround.Web.Host/Partner.Surround.Web.Host.csproj", "src/Partner.Surround.Web.Host/"]
COPY ["src/Partner.Surround.Web.Core/Partner.Surround.Web.Core.csproj", "src/Partner.Surround.Web.Core/"]
COPY ["src/Partner.Surround.EntityFrameworkCore/Partner.Surround.EntityFrameworkCore.csproj", "src/Partner.Surround.EntityFrameworkCore/"]
COPY ["src/Partner.Surround.Core/Partner.Surround.Core.csproj", "src/Partner.Surround.Core/"]
COPY ["src/Partner.Surround.Application/Partner.Surround.Application.csproj", "src/Partner.Surround.Application/"]
RUN dotnet restore "src/Partner.Surround.Web.Host/Partner.Surround.Web.Host.csproj"
COPY . .
WORKDIR "/src/src/Partner.Surround.Web.Host"
RUN dotnet build "Partner.Surround.Web.Host.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "Partner.Surround.Web.Host.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Partner.Surround.Web.Host.dll"]